<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        function Person(name, age){
            this.name = name;
            this.age = age;
        }
        var per1 =new Person('苏凉',21);
        var per2 =new Person('小红',15);
        var per3 =new Person('小月',17);
        var per4 =new Person('小丽',19);
        var per5 =new Person('小水',20);
        var per6 =new Person('小花',5);
    
        var per_list= [per1,per2,per3,per4,per5,per6];

        function arrAdult(){
            var newArr=[];
            for(var i = 0;i<per_list.length;i++){
                var x = per_list[i];
                if(x.age<18){
                    console.log(x.name + '未通过');
                }else if(x.age>=18){
                    console.log(x.name + '恭喜你，通过了！');
                    newArr.push(x.name)
                }
            }
            return newArr;
        }

        var list = arrAdult();
        console.log('通过名单：'+ list)


        // var arr = ['xiaohu','wei','gala','ming','breath'];
        //     var name_list = [];
        //     for(var i = 0 ;i<arr.length;i++){
        //         var x = arr[i];
        //         name_list.push(x);
        //     }
        //     console.log(name_list);

    </script>
</head>
<body>
    
</body>
</html>